/**
 * @date 9:25:17 AMS
 * StduentAPPServiceImpl.java
 * Administrator
 * TODO
 */
package com.qs.education.service.impl;
import javax.servlet.http.HttpServletRequest;

import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;

import com.qs.education.bean.api.ResponseBean;
import com.qs.education.bean.beans.EducationStudentBean;
import com.qs.education.bean.beans.EducationStudentResponse;
import com.qs.education.bean.entity.EducationStudent;
import com.qs.education.bean.service.BaseService;
import com.qs.education.service.IStudentAPPService;

/**
 * @class StduentAPPServiceImpl	
 * @author Warren
 * @description
 * @date Nov 1, 2018 
 */
@Service
public class StudentAPPServiceImpl extends BaseService implements IStudentAPPService{
	
	/**
	 * @author Warren
	 * @param id
	 * @return Map<String,Object>
	 * @description 
	 * @date Nov 20, 2018
	 */
	@Override
	public EducationStudentResponse getEducationStudent(Long id) {
		EducationStudentResponse educationStudent = apiCaller.getStudent(id);
		return educationStudent;
	}

	/**
	 * @author Warren
	 * @param mobile
	 * @param code
	 * @return ResponseBean
	 * @description 学生用户注册
	 * @date Nov 5, 2018
	 */
	@Override
	public ResponseBean register(EducationStudentBean student) {
		ResponseBean ResponseBean = apiCaller.register(student);
		return ResponseBean;
	}
	
	/**
	 * @author Warren
	 * @param mobile
	 * @param password
	 * @return EducationStudentResponse
	 * @description 学生登录
	 * @date Nov 6, 2018
	 */
	@Override
	public EducationStudentResponse login(String mobile, String password) {
		EducationStudentResponse educationStudent = apiCaller.studentLogin(mobile, password);
		return educationStudent;
	}

	/**
	 * @author Warren
	 * @param mobile
	 * @return ResponseBean
	 * @description 学生退出app端登录状态
	 * @date Nov 6, 2018
	 */
	@Override
	public ResponseBean exit(String mobile) {
		ResponseBean responseBean = apiCaller.exitStudent(mobile);
		return responseBean;
	}

	/**
	 * @author Warren
	 * @param mobile 手机号(相当于账号)
	 * @param password 新密码
	 * @return ResponseBean
	 * @description 重置密码
	 * @date Nov 6, 2018
	 */
	@Override
	public ResponseBean resetPwd(String mobile,String password) {
		ResponseBean responseBean = apiCaller.resetPwd(mobile, password);
		return responseBean;
	}

	/**
	 * @author Warren
	 * @param mobile
	 * @return ReponseBean
	 * @description 根据手机号查询是否已注册
	 * @date Nov 7, 2018
	 */
	@Override
	public ResponseBean mobileIsRepeat(String mobile) {
		ResponseBean responseBean = apiCaller.mobileIsRepeat(mobile);
		return responseBean;
	}

	/**
	 * @author Warren
	 * @param educationStduent
	 * @return ResponseBean
	 * @description 修改学生信息
	 * @date Nov 14, 2018
	 */
	@Override
	public ResponseBean updateStudentInfo(EducationStudent educationStudent,MultipartFile file,String schoolId,String gradeId,String classId,HttpServletRequest request) {
		ResponseBean responseBean = apiCaller.updateStudentInfo(educationStudent, file,schoolId, gradeId, classId,request);
		return responseBean;
	}
	
	/**
	 * @author Warren
	 * @param mobile 手机号
	 * @param oldPassword 原密码
	 * @param newPassword 新密码
	 * @return ResponseBean
	 * @description 修改密码
	 * @date Nov 20, 2018
	 */
	@Override
	public ResponseBean changePwd(String mobile,String oldPassword,String newPassword) {
		ResponseBean responseBean = apiCaller.changePwd(mobile, oldPassword, newPassword);
		return responseBean;
	}

	/**
	 * @author Warren
	 * @param groupId 
	 * @param studentId
	 * @return ResponseBean
	 * @description 学生主动退出班群
	 * @date Nov 20, 2018
	 */
	@Override
	public ResponseBean exitGroup(Long groupId, Long studentId) {
		ResponseBean responseBean = apiCaller.exitGroup(groupId, studentId);
		return responseBean;
	}
}
